<div class="row row-cards row-deck">
  <div class="col-2">
    <div class="card">
      <div class="card-body">
        <div class="form-group">
          <label class="form-label">商品处理</label>
          <div class="form-control-plaintext">
            <div><%= link_to "全部", admin_spus_path %></div>
            <div><%= link_to "审核", admin_spus_path(state: :oncheck) %></div>
            <div><%= link_to "通过", admin_spus_path(state: :onsale) %></div>
            <div><%= link_to "拒绝", admin_spus_path(state: :disagree) %></div>
          </div>
        </div>
        <div class="form-group">
          <label class="form-label">特殊分类</label>
            <div><%= link_to "严选", admin_spus_path(handpick: true) %></div>
        </div>
        <div class="form-group">
          <label class="form-label">商品分类</label>
          <%= shop_categories_tree_in_admin %>
        </div>
      </div>
    </div>
  </div>
  <div class="col-10">
    <div class="card">
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th>商品封面</th>
            <th>商品名字</th>
            <th>所属分类</th>
            <th>销售量</th>
            <th>状态</th>
            <th class="text-center"><i class="icon-settings"></i></th>
          </tr>
        </thead>
        <tbody>
          <% @spus.each do |spu| %>
          <tr>
            <td class="text-center">
              <div class="avatar d-block" style="background-image: url(<%= spu.avatar.url %>)">
                <span class="avatar-status bg-green"></span>
              </div>
            </td>
            <td>
              <div><%= spu.name %></div>
              <div class="small text-muted">
                <%= formattime(spu.created_at, unit: "day") %>
              </div>
            </td>
            <td>
              <div><%= spu.shop_category.name %></div>
            </td>
            <td>
              <div><%= spu.sales_volume %></div>
            </td>
            <td>
              <div><%= i18n_enum spu, :state %></div>
            </td>
            <td class="text-center">
              <div class="item-action dropdown">
                <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                <div class="dropdown-menu dropdown-menu-right">
                  <a href="<%= edit_admin_spu_path(spu) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
                  <%= link_to handpick_admin_spu_path(spu), class: "dropdown-item", method: :post do %>
                    <%= spu.handpick ? "移出严选" : "移入严选" %>
                  <% end %>
                  <%= link_to show_index_admin_spu_path(spu), class: "dropdown-item", method: :post do %>
                    <%= spu.show_index ? "移出首页" : "移入首页" %>
                  <% end %>
                </div>
              </div>
            </td>
          </tr>
          <% end %>
        </tbody>
      </table>
      <div class="card-footer">
        <%= paginate @spus %>
      </div>
    </div>
  </div>
</div>